<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
</head>
<body>
<div id="app">
<!-- <cpn v-bind:cmovies="movies" v-bind:cmessage="message"></cpn>-->
<!--  <cpn cmovies="movies" cmessage="message"></cpn>-->
  <cpn v-bind:cmovies="movies" ></cpn>

</div>

<template id="cpn">
  <div>
    <h2> <ul >
      <li v-for="item in cmovies">{{item}}</li>
    </ul></h2>
    <h3>{{cmessage}}</h3>
  </div>
</template>
  <script src="../../js/vue.js"></script>
  <script>
    //父传子：props
    const cpn = {
      template:'#cpn',
      // props:['cmovies','cmessage'],
      props:{
        //1.类型限制
        // cmovies:Array,
        // cmessage:String,

        //2.提供一些默认值,以及必传值
        cmessage:{
          type:String,
          default:'55555555',
          required:true   //必须传值
        },
        cmovies:{
          type:Array,
          default(){
            return[]
          }
        }
      },
      data(){
    return{}
      }
    }

    const app = new Vue({
      el:'#app',
      data:{
        message:"你好呀！！",
        movies:['海王','海贼王','海尔兄弟']
      },
      components:{
        cpn
      }
    })
  </script>
</body>
</html>